import * as THREE from 'three';
import {repeatWrapping} from '@/utils/repeatWrapping';
import albedo from '@/texture/iron/Albedo.jpg';
import nomals from '@/texture/iron/Normal.jpg'
import displacement from '@/texture/iron/Displacement.jpg'
import roughnesses from '@/texture/iron/Roughness.jpg'
import metalness from '@/texture/iron/Metalness.jpg'

const map = new THREE.TextureLoader().load(albedo);//颜色材质贴图
const nomal = new THREE.TextureLoader().load(nomals);//法线材质贴图
const displacements = new THREE.TextureLoader().load(displacement);//位移贴图
const roughness = new THREE.TextureLoader().load(roughnesses);//材质的粗糙度贴图
const metalnesses = new THREE.TextureLoader().load(metalness);//金属度贴图

repeatWrapping(map,20,20);//重复平铺颜色贴图
repeatWrapping(nomal,20,20);//重复平铺法线贴图
repeatWrapping(displacements,20,20);//重复平铺透明度贴图
repeatWrapping(roughness,20,20);//重复平铺粗糙度贴图
repeatWrapping(metalnesses,20,20);//重复平铺高光贴图


const material = new THREE.MeshStandardMaterial( 
    { 
        color: 0x969696
        
    }
);

material.map = map
material.normalMap = nomal
material.displacementMap = displacements
material.roughnessMap = roughness
material.metalnessMap = metalnesses
material.emissive = 0x000000
material.roughness = 0
material.metalness = 1
 




export default material